/**
 * 
 * Workspace is the layout controller which defines the layout 
 * of the workspace and the size and position of its components
 * 
 * Required Features:
 * 1. Project Explorer
 * 2. Menubar (File, Project, Run)
 * 
 */

if (!dojo._hasResource['dojoide.workspace.Workspace']) {
    dojo._hasResource['dojoide.workspace.Workspace'] = true;
    dojo.provide('dojoide.workspace.Workspace');

	dojo.require('dijit.layout.ContentPane');
    
	dojo.require('dojoide.workspace.OutputPane');
	dojo.require('dojoide.workspace.AutoCompletePane');
	dojo.require('dojoide.workspace.CodeEditor');

    //Dojo IDE Workspace
    dojo.declare("dojoide.workspace.Workspace", [dijit.layout.ContentPane], {
        postCreate: function(){
            this.inherited(arguments);
            console.info('Dojo ' + dojo.version + ' has been loaded successfully');

	        var codeEditor = null;
	        
	        var msgPane = null;
	        
	        var autoCompPane = null;
        
			//CodeEditor
            var div = dojo.doc.createElement('div');
            this.domNode.appendChild(div);
            codeEditor = new dojoide.workspace.CodeEditor({
                style: 'position: absolute; border: 1px solid lightgrey; top: 1%; left: 1%; height: 79%; width: 95%;'
            }, div);

			//OutputPane - general messages
            div = dojo.doc.createElement('div');
            this.domNode.appendChild(div);
            msgPane = new dojoide.workspace.AutoCompletePane({
                title: 'Output',
                moveable: 'false',
                style: 'position: absolute; top: 81%; left: 1%; height: 18%; width: 95%;'
            }, div);
//            msgPane.hide();


			//OutlinePane - autocomplete
            div = dojo.doc.createElement('div');
            this.domNode.appendChild(div);
            autoCompPane = new dojoide.workspace.AutoCompletePane({
                title: 'Object Members',
                moveable: 'true',
                style: 'position: absolute; top: 1%; left: 71%; height: 40%; width: 25%;'
            }, div);
            autoCompPane.hide();

            codeEditor.setMsgPane(msgPane);
            codeEditor.setAutoCompPane(autoCompPane);
        }
    });
}
